/*
 *  game.h
 *
 *  $Id: game.h 7 2009-08-16 13:27:17Z nramsbottom $
 *
 */

#define MAX_PLAYERS	 2
#define TOKEN_NONE	'\0'

typedef struct {
	unsigned char cell[9];
} board_t;

typedef struct {
	char id;
	char name[32];		
	char token;			// X or 0
} player_t;

// main game loop
void game_run(void);

// initialise the board and players for a new game
static void game_new(void);

// determine if there is a winner on the current board
static player_t* game_haswinner(void);

// gather player input and process
static void game_getmove(void);

// switch the current player for the next player
static void game_toggleplayer(void);

// obtain a pointer to a player based on the token that they're using
static player_t* game_findplayerbytoken(char token);

// find a token on the board, given it's x and y co-ordinate
unsigned char game_getboardtoken(int x, int y);

// set a token on the board, given the x and y co-ordindate
void game_setboardtoken(int x, int y, unsigned char token);
